/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package view;

import java.awt.Color;
import java.awt.Component;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
import model.TaskGroup;

/**
 *
 * @author Luci
 */
class GroupCell extends JLabel implements ListCellRenderer{
        public final Color HIGHLIGHT_COLOR = new Color(0, 0, 128);
        public GroupCell(){
            setOpaque(true);
            setIconTextGap(12);
            setSize(200,50);
            
        }
        @Override
        public Component getListCellRendererComponent(JList list, Object value, 
                int index, boolean isSelected, boolean cellHasFocus) {
            //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
            TaskGroup taskgroup = (TaskGroup) value;
            setText(taskgroup.getName());
            setIcon(new ImageIcon(taskgroup.getIcon()));
            setVisible(true);
            if(isSelected){
                setBackground(HIGHLIGHT_COLOR);
                setForeground(Color.white);
                
            }else{
                setBackground(Color.white);
                setForeground(Color.black);
            }
            return this;
            
        }
        
        
    }
